No. Your solution only works if they only enter "key""enter". If they enter more than one "key" before hitting enter, it'll loop for as many "key"s you press. Replace your getchar line with the while solution Thantos mentioned.

Remember, you have to code down to the level of the stupidest user.

Quzah.